package com.ruoyi.merchant.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.Shop;
import com.ruoyi.common.core.domain.ShopVerification;
import com.ruoyi.common.core.domain.SysUserRole;
import com.ruoyi.merchant.api.RemoteMerchantService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteMerchantFallbackFactory implements FallbackFactory<RemoteMerchantService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteMerchantFallbackFactory.class);

    @Override
    public RemoteMerchantService create(Throwable throwable) {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteMerchantService() {
            @Override
            public Integer registerShop(Shop shop, String source) {
                return -1;
            }

            @Override
            public Integer registerShopVerification(ShopVerification shopVerification, String source) {
                return -1;
            }
        };
    }
}
